package com.soft.one;

import com.soft.one.db.UserDb;
import com.soft.one.myprintf.MyPrintfs;

import java.util.Scanner;

/**
 * 酒店管理系统
 */
public class MyStart {

    public static void main(String[] args) {
        //启动系统
        MyPrintfs.startPrintf();
        System.out.println(System.getProperty("user.dir"));
        //加载数据
        UserDb.loadData();

        int loginNum = 0;
        while (true) {
            LoginService loginService = new LoginService();
            boolean isLogin = loginService.login();

            if (isLogin) {
                while (isLogin) {
                    //进入系统
                    //功能选择
                    //功能打印
                    MyPrintfs.menuPrintf();

                    Scanner sc = new Scanner(System.in);
                    int select = sc.nextInt();
                    switch (select) {
                        case 1:
                            System.out.println("菜品选择");
                            MenuService.foodSelect();
                            break;
                        case 2:
                            System.out.println("已选菜品");
                            MenuService.selected();
                            break;
                        case 3:
                            System.out.println("结算");
                            BalanceService.balancePrice();
                            break;
                        case 4:
                            System.out.println("个人中心");
                            LoginService.loginInfo();
                            break;
                        case 5:
                            isLogin = false;
                            break;
                        default:
                            System.out.println("功能开发中...");
                    }
                }
            } else {
                loginNum++;
                if (loginNum == 3) {
                    System.out.println("登录次数超过3次！！！");
                    //系统结束
                    MyPrintfs.endPrintf();
                    loginNum = 0;
                }
            }
        }
    }
}
